#pragma once
#include <string>
namespace TOK
{
const auto IDENTIFIER = 0x0001;
const auto NUMBER = 0x0002;
const auto LPAREN = 0x0010;
const auto RPAREN = 0x0011;
const auto PLUS = 0x0012;
const auto MINUS = 0x0013;
const auto NOT = 0x0014;
const auto MUL = 0x0015;
const auto DIV = 0x0016;
const auto MOD = 0x0017;
const auto GT = 0x0018;
const auto LT = 0x0019;
const auto GE = 0x001a;
const auto LE = 0x001b;
const auto EQ = 0x001c;
const auto NE = 0x001d;
const auto LAND = 0x001e;
const auto LOR = 0x001f;
const auto ASSIGN = 0x0020;
const auto BAND = 0x0021;
const auto BOR = 0x0022;
const auto BNOT = 0x0023;
const auto SAL = 0x0024;
const auto SAR = 0x0025;
const auto XOR = 0x0026;
const auto ADDASSIGN = 0x0027;
const auto SUBASSIGN = 0x0028;
const auto MULASSIGN = 0x0029;
const auto DIVASSIGN = 0x002A;
const auto MODASSIGN = 0x002B;
const auto ANDASSIGN = 0x002C;
const auto ORASSIGN = 0x002D;
const auto XORASSIGN = 0x002E;
const auto SALASSIGN = 0x002F;
const auto SARASSIGN = 0x0030;
const auto SEMICOLON = 0x0031;
const auto COMMA = 0x0032;
const auto QUESTION = 0x0033;
const auto COLON = 0x0034;
const auto K_CONST = 0x0040;
const auto K_INT = 0x0041;
const auto INCR = 0x0050;
const auto DECR = 0x0051;
const auto ERR = 0xffff;
const auto SCANEOF = 0xfffe;
const auto UNDEFINED = 0xfffd;
}
class LEX
{
    bool (*eof)();
    int (*get_char)();
    int next_char();
    inline void back_char(int);
    int in_buf;
    const int in_buf_empty = -1;
    std::string buffer;
    int token_buffer;
    int lexer();
public:
    LEX();
    LEX(int(*n_c)(),bool (*eof)());
    std::string get_buffer();
    int next_token();
    void match(int want);
};

